<template>
  <el-container>
    <el-aside width="230px" style="height: 600px;">
      <el-menu default-active="1" class="el-menu-vertical-demo">
        <el-menu-item index="1">
          <router-link to="/ListingBooks" class="menu-link">订单管理</router-link>
        </el-menu-item>
        <el-menu-item index="2">
          <router-link to="/Map" class="menu-link">打卡</router-link>
        </el-menu-item>
        <el-submenu index="3">
          <template slot="title">
            <span class="menu-link">个人订单</span>
          </template>
          <el-menu-item index="3-1">
            <router-link to="/Order1" class="menu-link">查看正在进行的订单</router-link>
          </el-menu-item>
          <el-menu-item index="3-2">
            <router-link to="/ViewCompletedOrders" class="menu-link">已完成的订单</router-link>
          </el-menu-item>
          <el-menu-item index="3-3">
            <router-link to="/MyOrder" class="menu-link">待结案工单</router-link>
          </el-menu-item>
        </el-submenu>
        <el-menu-item index="4">
          <router-link to="/ListingBooks" class="menu-link">个人资料</router-link>
        </el-menu-item>
        <el-menu-item index="5">
          <router-link to="/ChatRoom" class="menu-link">线上订单处理</router-link>
        </el-menu-item>
        <el-menu-item index="6">
          <router-link to="/ListingBooks" class="menu-link" @click="logout">退出登录</router-link>
        </el-menu-item>
      </el-menu>
    </el-aside>

    <el-container>
      <el-header>
        <h1>工作人员管理系统</h1>
        <p>欢迎，{{ userName }}</p>
      </el-header>

      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  data() {
    return {
      activeIndex: '1',  // 默认选中的菜单项
    };
  },
  methods: {
    logout() {
      this.$message('已退出登录');
    },
  },
};
</script>

<style scoped>
.el-header {
  background-color: #f2f2f2;
  padding: 20px;
  text-align: center;
}
.el-menu-vertical-demo {
  width: 200px;
  background: #f9f9f9;
}

.menu-link {
  text-decoration: none;
  color: inherit;
}

.menu-link:hover {
  color: #409EFF;
}
</style>
